//
//  PostCellToolBarButton.swift
//  WeiboDemo
//
//  Created by 姬向阳 on 2020/4/19.
//  Copyright © 2020 SUNNYJ. All rights reserved.
//

import SwiftUI

struct PostCellToolBarButton: View {
    var image : String
    var text : String
    var color : Color
    let action : () -> Void
    
    
    var body: some View {
        HStack {
            Button(action: action) {
                HStack(spacing: 5){
                    Image(systemName: image)
                        .resizable()
                        .scaledToFit()
                        .frame(width: 18, height: 18)
                    Text(text)
                        .font(.system(size: 15))
                }
            }
            .foregroundColor(color)
        }
    }
}

struct PostCellToolBarButton_Previews: PreviewProvider {
    static var previews: some View {
        PostCellToolBarButton(image: "heart", text: "点赞", color: .red, action: {
            print("点赞")
        })
    }
}
